package com.coc.dao.system;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.coc.entity.system.SysPermission;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 权限表(SysPermission)表数据库访问层
 *
 * @author songju
 * @since 2020-02-10 19:12:17
 */
@Component
public interface SysPermissionDao extends BaseMapper<SysPermission> {
    List<SysPermission> selectListByUser(Integer id);
    List<SysPermission>  selectListByPath(String requestUrl);
    @Select("SELECT * FROM sys_permission WHERE id in(SELECT permit_id FROM sys_role_permission WHERE role_id in(SELECT role_id FROM sys_user_role WHERE user_id =#{userId}))")
    List<SysPermission> getPermitById(Integer userId);
}